<?php
namespace app\api\controller;

use think\Controller;
use think\facade\Request;

class Url extends Controller{
    
    /**
     * @desc 创建url链接
     */
    public function build() {
        $params['link']       = Request::post('link');
        $params['expireTime'] = Request::post('expireTime');
        $params['password']   = Request::post('password', '');
        $params['remark']     = Request::post('remark', '');
        
        $logic = model('Url', 'logic');
        $data = [];
        try {
            $data = $logic->build($params, API_USER_ID);
        } catch (\Exception $e) {
            $logic->message = $e->getMessage();
        }
        return send_response($data, $logic->errorCode);
    }
}
